using System.Data;
using ET;
namespace DAL
{
    public class Enterprise_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdEnterprise(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Enterprise_Search");
        }
        public DataTable BindGirdEnterpriseDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Enterprise_Id", id);
            return cls.GetData("sp_tb_Enterprise_Detail");
        }
        #endregion

        #region Insert
        public bool InsertEnterprise(Enterprise_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Enterprise_Alias", data.Enterprise_Alias);
            cls.AddParameter("@Enterprise_Name", data.Enterprise_Name);
            cls.AddParameter("@Enterprise_Note", data.Enterprise_Note);
            cls.AddParameter("@Enterprise_User_Add", data.Enterprise_User_Add);
            cls.AddParameter("@Enterprise_Date_Add", data.Enterprise_Date_Add);
            cls.AddParameter("@Enterprise_Computer_Add", data.Enterprise_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Enterprise_Insert");
        }
        #endregion

        #region Update
        public bool UpdateEnterprise(Enterprise_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Enterprise_ID", data.Enterprise_ID);
            cls.AddParameter("@Enterprise_Alias", data.Enterprise_Alias);
            cls.AddParameter("@Enterprise_Name", data.Enterprise_Name);
            cls.AddParameter("@Enterprise_Note", data.Enterprise_Note);
            cls.AddParameter("@Enterprise_User_Modify", data.Enterprise_User_Modify);
            cls.AddParameter("@Enterprise_Date_Modify", data.Enterprise_Date_Modify);
            cls.AddParameter("@Enterprise_Computer_Modify", data.Enterprise_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Enterprise_Update");
        }
        #endregion

        #region Delete
        public bool DeleteEnterprise(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Enterprise_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Enterprise_Delete");
        }
        #endregion
    }
}